{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9ac761ac",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "dee0d501",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>序号</th>\n",
       "      <th>学号</th>\n",
       "      <th>姓名</th>\n",
       "      <th>计算机</th>\n",
       "      <th>英语</th>\n",
       "      <th>大学语文</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>W1234</td>\n",
       "      <td>让让</td>\n",
       "      <td>60</td>\n",
       "      <td>89</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>W1235</td>\n",
       "      <td>兰兰</td>\n",
       "      <td>77</td>\n",
       "      <td>68</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>W1236</td>\n",
       "      <td>娜娜</td>\n",
       "      <td>87</td>\n",
       "      <td>85</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>W1237</td>\n",
       "      <td>芳芳</td>\n",
       "      <td>69</td>\n",
       "      <td>79</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>W1238</td>\n",
       "      <td>露露</td>\n",
       "      <td>88</td>\n",
       "      <td>64</td>\n",
       "      <td>84</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   序号     学号  姓名  计算机  英语  大学语文\n",
       "0   0  W1234  让让   60  89    70\n",
       "1   1  W1235  兰兰   77  68    80\n",
       "2   2  W1236  娜娜   87  85    92\n",
       "3   3  W1237  芳芳   69  79    86\n",
       "4   4  W1238  露露   88  64    84"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "学生信息 = pd.read_excel(R'D:\\P24101211 罗晨露 python\\luo-chenlu\\数据.xlsx')\n",
    "学生信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "344c7129",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    让让\n",
       "1    兰兰\n",
       "2    娜娜\n",
       "3    芳芳\n",
       "4    露露\n",
       "Name: 姓名, dtype: object"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "学生信息.姓名"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "11397056",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>大学语文</th>\n",
       "      <th>计算机</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>70</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>80</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>92</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>86</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>84</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   大学语文  计算机\n",
       "0    70   60\n",
       "1    80   77\n",
       "2    92   87\n",
       "3    86   69\n",
       "4    84   88"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "学生信息[['大学语文','计算机']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "0dfa9517",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, [2, 3], '3']"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[1,[2,3],'3']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "6b609911",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.int64(60)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "学生信息.loc[0,'计算机']\n",
    "#loc 是根据标签索引数据，通常用于根据行索引和列索引，第一个参数是行索引，第二个参数是列索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "f8a4d6cc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "大学语文    84\n",
       "英语      64\n",
       "Name: 4, dtype: object"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "学生信息.loc[4,['大学语文','英语']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "83227b96",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>大学语文</th>\n",
       "      <th>英语</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>86</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>84</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   大学语文  英语\n",
       "3    86  79\n",
       "4    84  64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "学生信息.loc[[3,4],['大学语文','英语']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "65a707dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>计算机</th>\n",
       "      <th>大学语文</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>77</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>87</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>69</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>88</td>\n",
       "      <td>84</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   计算机  大学语文\n",
       "1   77    80\n",
       "2   87    92\n",
       "3   69    86\n",
       "4   88    84"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "学生信息.loc[1:5,['计算机','大学语文']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "028f2de6",
   "metadata": {},
   "outputs": [],
   "source": [
    "list1 = [0,1,2,3,4,5,6,7,8,9,10]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
